let path = "/../"
var simplifyPath = function (path) {
    const names = path.split("/");
    const stack = [];
    for (na of names) {
        if (na === '..') {
            if (stack.length) {
                stack.pop()
            }

        }
        else if (na.length && na !== '.') {
            stack.push(na)
        }
    }
    return '/' + stack.join('/')
};
console.log(simplifyPath(path));
